﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace WCS.Infrastructure.EFCore;

/// <summary>
/// 优惠券包表
/// </summary>
[Table("CouponPackage")]
[Index("PackageCode", Name = "CouponPackage_PackageCode_idx", IsUnique = true)]
public partial class CouponPackage
{
    /// <summary>
    /// 优惠券包ID
    /// </summary>
    [Key]
    [StringLength(32)]
    public string Id { get; set; } = null!;

    /// <summary>
    /// 优惠券包编号
    /// </summary>
    [StringLength(32)]
    public string PackageCode { get; set; } = null!;

    /// <summary>
    /// 优惠券包名称
    /// </summary>
    [StringLength(64)]
    public string Name { get; set; } = null!;

    /// <summary>
    /// 优惠券包描述
    /// </summary>
    [StringLength(255)]
    public string? Description { get; set; }

    /// <summary>
    /// 优惠券包二维码图片地址
    /// </summary>
    [Column("QRCodeUrl")]
    [StringLength(255)]
    public string? QrcodeUrl { get; set; }

    /// <summary>
    /// 归属商家ID（平台）
    /// </summary>
    [StringLength(32)]
    public string MerchantId { get; set; } = null!;

    /// <summary>
    /// 券包生效时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime StartTime { get; set; }

    /// <summary>
    /// 券包失效时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime EndTime { get; set; }

    /// <summary>
    /// 券包状态：1=草稿（未发布），2=已发布（可领取），3=已停用（停止领取）
    /// </summary>
    public int Status { get; set; }

    /// <summary>
    /// 总领取次数
    /// </summary>
    public int? IssueCount { get; set; }

    /// <summary>
    /// 已使用次数
    /// </summary>
    public int? UsedCount { get; set; }

    /// <summary>
    /// 扩展属性
    /// </summary>
    public string? ExtraProperties { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 创建人ID
    /// </summary>
    [StringLength(32)]
    public string? CreatorId { get; set; }

    /// <summary>
    /// 最后修改时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime? LastModificationTime { get; set; }

    /// <summary>
    /// 最后修改人ID
    /// </summary>
    [StringLength(32)]
    public string? LastModifierId { get; set; }

    /// <summary>
    /// 是否删除
    /// </summary>
    public bool IsDeleted { get; set; }

    /// <summary>
    /// 删除者ID
    /// </summary>
    [StringLength(32)]
    public string? DeleterId { get; set; }

    /// <summary>
    /// 删除时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime? DeletionTime { get; set; }

    /// <summary>
    /// 启用状态
    /// </summary>
    public int EnableStatus { get; set; }
}
